$(function(){
    $('select').select2({
        minimumResultsForSearch: Infinity
    });

    // 查询条件的展开关闭
    var addonQueryEl = $('.j-addon-query');
    var foldBtnEl = $('.j-fold-btn');
    foldBtnEl.on('click', function(ev) {
        ev.preventDefault();
        addonQueryEl.toggle();
        foldBtnEl.toggleClass('active');
    })

    // 动态计算列表元素高度
    function alignItems (selecter) {
        var ulEl = $(selecter);
        var liEls = ulEl.children();
        for (var i = 0; i < liEls.length; i+=4) {
            var maxHeight = 0;
            for (var j = 0; j < 4; j++) {
                var tempHeight = liEls.eq(i + j).addClass('j-row-' + i).outerHeight();
                maxHeight = tempHeight > maxHeight? tempHeight : maxHeight;
            }
            $('.j-row-' + i + ' .expert-content').css('height', maxHeight - 96);
        }
    }

    alignItems('.j-expert-list');
})